{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "c4020c04-2e0b-4798-b750-df2527229451",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "a除以b的商为3.333,余数为:1。\n"
     ]
    }
   ],
   "source": [
    "a=10\n",
    "b=3\n",
    "c=a/b\n",
    "d=a%b\n",
    "print(f\"a除以b的商为{c:.3f},余数为:{d}。\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "7aece8c1-f41f-406d-bf56-8070eaa37ec1",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "english和math的分数之差：6\n",
      "三门课的平均成绩:92.0\n"
     ]
    }
   ],
   "source": [
    "english = 95\n",
    "math =92\n",
    "python =89\n",
    "a= english - python\n",
    "b=(english + math + python )/3\n",
    "print(f\"english和math的分数之差：{a}\")\n",
    "print(f\"三门课的平均成绩:{b}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 97,
   "id": "1b689679-acb7-4990-ab3e-09b1ca4e8450",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "5366.563145999496\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "总现金需求 = 300000\n",
    "成本 = 400\n",
    "利率 = 0.12\n",
    "#设a为最佳现金持有量\n",
    "a = 2*300000*400*0.12\n",
    "b = math.sqrt(a)  \n",
    "print(b)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "id": "0a968994-31e9-4655-bc13-2688f7a4d698",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "柳州\n",
      "['柳州', '桂林', '北海']\n",
      "['南宁', '柳州', '桂林', '北海', '钦州', '横州', '河池']\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "7"
      ]
     },
     "execution_count": 73,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "guangxi = ['南宁','柳州','桂林','北海','钦州']\n",
    "print(guangxi[1])\n",
    "print(guangxi[1:4])\n",
    "a = ['横县','河池']\n",
    "a[0] = '横州'\n",
    "guangxi.extend(a)\n",
    "print(guangxi)\n",
    "len(guangxi)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 87,
   "id": "bff5a5b9-480a-4a56-929f-1f9ee54cee1c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['现金', 786, 2.23, 'ABC', 70.2, 123, '银行存款']\n",
      "[123, '银行存款', 123, '银行存款']\n",
      "现金\n",
      "[786, 2.23]\n",
      "[2.23, 'ABC', 70.2]\n"
     ]
    }
   ],
   "source": [
    "list1 = ['现金',786,2.23,'ABC',70.2]\n",
    "list2 = [123,'银行存款' ]\n",
    "list1.extend(list2)\n",
    "print(list1)\n",
    "list2.extend(list2)\n",
    "print(list2)\n",
    "print(list1[0])\n",
    "print(list1[1:3])\n",
    "list1 = ['现金',786,2.23,'ABC',70.2]\n",
    "print(list1[2:5])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "bd9a74a6-e863-403c-a2c0-5a02c400cb9f",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
